package com.xjnt.base.support.admin.service;

import java.util.List;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.xjnt.base.support.admin.entity.Org;
import com.xjnt.frameworks.annotation.Service;
import com.xjnt.frameworks.core.BaseService;
import com.xjnt.frameworks.plugin.sql.SqlKit;

@Service
public class OrgService extends BaseService<Org> {

	@Override
	public Org getModel() {
		return Org.me;
	}

	public List<Record> findByParentId(String parentId){
		if( null == parentId){
			return Db.find(SqlKit.findSql("Org.findByParentIsNull"));
		}
		return Db.find(SqlKit.findSql("Org.findByParent"), parentId);
	}
}
